package LuoGu;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.StreamTokenizer;
import java.util.HashMap;
import java.util.Objects;

public class P36132 {
    public static void main(String[] args) throws IOException {
        StreamTokenizer st = new StreamTokenizer(new BufferedReader(new InputStreamReader(System.in)));
        st.nextToken();
        int n = (int) st.nval;
        st.nextToken();
        int len=(int)st.nval;
        int index=0;
        HashMap<G,Integer> g=new HashMap<>();
        int[] find=new int[len];
        for (int i = 0; i < len; i++) {
            st.nextToken();
            int is=(int)st.nval;
            st.nextToken();
            int gui=(int)st.nval;
            st.nextToken();
            int ge=(int)st.nval;
            if(is==1){
                st.nextToken();
                int k=(int)st.nval;
                g.put(new G(gui,ge),k);
            }else{
                find[index++]=g.get(new G(gui,ge));
            }
        }
        for (int i = 0; i < index; i++) {
            System.out.println(find[i]);
        }

    }
    public static class G{
        public Integer gui;
        public Integer ge;

        public G() {
        }

        public G(Integer gui, Integer ge) {
            this.gui = gui;
            this.ge = ge;
        }

        /**
         * 获取
         * @return gui
         */
        public Integer getGui() {
            return gui;
        }

        /**
         * 设置
         * @param gui
         */
        public void setGui(Integer gui) {
            this.gui = gui;
        }

        /**
         * 获取
         * @return ge
         */
        public Integer getGe() {
            return ge;
        }

        /**
         * 设置
         * @param ge
         */
        public void setGe(Integer ge) {
            this.ge = ge;
        }

        @Override
        public boolean equals(Object o) {
            if (this == o) return true;
            if (o == null || getClass() != o.getClass()) return false;
            G g = (G) o;
            return Objects.equals(gui, g.gui) && Objects.equals(ge, g.ge);
        }

        @Override
        public int hashCode() {
            return Objects.hash(gui, ge);
        }

        public String toString() {
            return "G{gui = " + gui + ", ge = " + ge + "}";
        }
    }
}
